<!DOCTYPE html>
<html>
  <head>
  <meta charset='UTF-8'>
  <title>Atom API Documentation</title>
  <link rel='stylesheet' href='../assets/biscotto.css' type='text/css'>
  <script src='../assets/biscotto.js'></script>
  <script src='../assets/search_data.js'></script>
</head>
  <body>
    <div id='base' data-path='..&#47;'></div>
<div id='header'>
  <div id='menu'>
    <a href='../docs/README.md.html' title='Atom'>Atom</a>
    &raquo;
    <a href='../class_index.html' title='Index'>Index</a>
    &raquo;
    <span class='title'>TextBuffer</span>
    <nav>
      <ul>
        <li class='noframes'>
          (<a class='noframes' href='TextBuffer.html#'>no frames</a>)
        </li>
      </ul>
    </nav>
    <div id='search'>
      <a id='class_list_link' href='../class_list.html'>Classes</a>
      <a id='file_list_link' href='../file_list.html'>Files</a>
      <a id='method_list_link' href='../method_list.html'>Methods</a>
      <a id='extra_list_link' href='../extra_list.html'>Extras</a>
    </div>
  </div>
  <iframe id='search_frame'></iframe>
  <div id='fuzzySearch'>
    <input type='text'>
    <ol></ol>
  </div>
  <div id='help'>
    <p>
      Quickly fuzzy find classes, mixins, methods, file:
    </p>
    <ul>
      <li>
        <span>Ctrl-T</span>
        Open fuzzy finder dialog
      </li>
    </ul>
    <p>
      In frame mode you can toggle the list naviation frame on the left side:
    </p>
    <ul>
      <li>
        <span>Ctrl-L</span>
        Toggle list view
      </li>
    </ul>
    <p>
      You can focus a list in frame mode or toggle a tab in frameless mode:
    </p>
    <ul>
      <li>
        <span>Ctrl-C</span>
        Class list
      </li>
      <li>
        <span>Ctrl-I</span>
        Mixin list
      </li>
      <li>
        <span>Ctrl-F</span>
        File list
      </li>
      <li>
        <span>Ctrl-M</span>
        Method list
      </li>
      <li>
        <span>Ctrl-E</span>
        Extras list
      </li>
    </ul>
    <p>
      You can focus and blur the search input:
    </p>
    <ul>
      <li>
        <span>Ctrl-S</span>
        Focus search input
      </li>
      <li>
        <span>Esc</span>
        Blur search input
      </li>
    </ul>
    <p>
      In frameless mode you can close the list tab:
    </p>
    <ul>
      <li>
        <span>Esc</span>
        Close list tab
      </li>
    </ul>
  </div>
</div>
    <div id='content'>
      <h1>
        Class
        TextBuffer
      </h1>
      <div class='stability-1'>
        <span class='heading'></span>
        <div class='message'></div>
      </div>
      <table class='box'>
        <tr>
          <td>Defined in:</td>
          <td>docs&#47;includes&#47;text-buffer&#47;src&#47;text-buffer.coffee</td>
        </tr>
      </table>
      <h2>Overview</h2>
      <div class='docstring'>
  <p>A mutable text container with undo/redo support and the ability to annotate logical regions in the text.</p>
</div>
<div class='tags'>
</div>
      <h2>Instance Method Summary</h2>
      <ul class='summary'>
  <li>
    <span class='signature'>
      <a href='TextBuffer.html#append-instance'>
        Range ::<strong>append</strong>(text, normalizeLineEndings)
      </a>
    </span>
    <span class='desc'>
      Appends the given text to the end of the buffer
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='TextBuffer.html#characterIndexForPosition-instance'>
        ::<strong>characterIndexForPosition</strong>(position)
      </a>
    </span>
    <span class='desc'>
      Given a <a href='Point.html'>Point</a> representing a position in the buffer, returns a <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number'>Number</a> representing the absolute character offset of that location in the buffer, inclusive of newlines.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='TextBuffer.html#clipPosition-instance'>
        ::<strong>clipPosition</strong>(position)
      </a>
    </span>
    <span class='desc'>
      Clips the given point so it is at a valid position in the buffer.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='TextBuffer.html#clipRange-instance'>
        Range ::<strong>clipRange</strong>(range)
      </a>
    </span>
    <span class='desc'>
      Clips the given range so it starts and ends at valid positions if its start or end are out of bounds.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='TextBuffer.html#constructor-instance'>
        ::<strong>constructor</strong>(params)
      </a>
    </span>
    <span class='desc'>
      Create a new buffer with the given params.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='TextBuffer.html#delete-instance'>
        Range ::<strong>delete</strong>(range)
      </a>
    </span>
    <span class='desc'>
      Deletes the text in the given range
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='TextBuffer.html#deleteRow-instance'>
        Range ::<strong>deleteRow</strong>(row)
      </a>
    </span>
    <span class='desc'>
      Deletes the line associated with the specified row.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='TextBuffer.html#deleteRows-instance'>
        Range ::<strong>deleteRows</strong>(startRow, endRow)
      </a>
    </span>
    <span class='desc'>
      Deletes the specified lines associated with the specified row range.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='TextBuffer.html#getEndPosition-instance'>
        ::<strong>getEndPosition</strong>()
      </a>
    </span>
    <span class='desc'>
      Returns a <a href='Point.html'>Point</a> representing the maximal position in the buffer.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='TextBuffer.html#getFirstPosition-instance'>
        ::<strong>getFirstPosition</strong>()
      </a>
    </span>
    <span class='desc'>
      Returns a <a href='Point.html'>Point</a> at [0, 0]
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='TextBuffer.html#getLastLine-instance'>
        ::<strong>getLastLine</strong>()
      </a>
    </span>
    <span class='desc'>
      Returns a <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String'>String</a> representing the last line of the buffer
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='TextBuffer.html#getLastRow-instance'>
        ::<strong>getLastRow</strong>()
      </a>
    </span>
    <span class='desc'>
      Returns a <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number'>Number</a> representing the last zero-indexed row number of the buffer.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='TextBuffer.html#getLineCount-instance'>
        ::<strong>getLineCount</strong>()
      </a>
    </span>
    <span class='desc'>
      Returns a <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number'>Number</a> representing the number of lines in the buffer.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='TextBuffer.html#getLines-instance'>
        ::<strong>getLines</strong>()
      </a>
    </span>
    <span class='desc'>
      Returns an <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array'>Array</a> of <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String'>String</a>s representing all the lines in the buffer, without line endings.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='TextBuffer.html#getMaxCharacterIndex-instance'>
        ::<strong>getMaxCharacterIndex</strong>()
      </a>
    </span>
    <span class='desc'>
      Returns the length of the buffer in characters.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='TextBuffer.html#getRange-instance'>
        ::<strong>getRange</strong>()
      </a>
    </span>
    <span class='desc'>
      Returns a <a href='Range.html'>Range</a> associated with the text of the entire buffer, from its first position to its last position.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='TextBuffer.html#getText-instance'>
        ::<strong>getText</strong>()
      </a>
    </span>
    <span class='desc'>
      Returns a <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String'>String</a> representing the entire contents of the buffer.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='TextBuffer.html#getTextInRange-instance'>
        ::<strong>getTextInRange</strong>(range)
      </a>
    </span>
    <span class='desc'>
      Returns a <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String'>String</a> of text in the given <a href='Range.html'>Range</a>.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='TextBuffer.html#insert-instance'>
        Range ::<strong>insert</strong>(position, text, normalizeLineEndings)
      </a>
    </span>
    <span class='desc'>
      Inserts the given text at the given position
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='TextBuffer.html#isEmpty-instance'>
        ::<strong>isEmpty</strong>()
      </a>
    </span>
    <span class='desc'>
      Returns a <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Boolean'>Boolean</a>, <code>true</code> if this buffer has no text, <code>false</code> otherwise.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='TextBuffer.html#lineEndingForRow-instance'>
        ::<strong>lineEndingForRow</strong>(row)
      </a>
    </span>
    <span class='desc'>
      Returns a <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String'>String</a> representing the line ending for the given row.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='TextBuffer.html#lineForRow-instance'>
        ::<strong>lineForRow</strong>(row)
      </a>
    </span>
    <span class='desc'>
      Returns a <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String'>String</a> representing the contents of the line at the given row.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='TextBuffer.html#lineLengthForRow-instance'>
        ::<strong>lineLengthForRow</strong>(row)
      </a>
    </span>
    <span class='desc'>
      Returns a <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number'>Number</a> representing the line length for the given row, exclusive of its line-ending character(s).
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='TextBuffer.html#positionForCharacterIndex-instance'>
        ::<strong>positionForCharacterIndex</strong>(offset)
      </a>
    </span>
    <span class='desc'>
      Given a <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number'>Number</a> represting an absolute offset in the buffer, inclusive of newlines, returns a <a href='Point.html'>Point</a> representing that numbers corresponding position in row/column coordinates.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='TextBuffer.html#rangeForRow-instance'>
        Range ::<strong>rangeForRow</strong>(row, includeNewline)
      </a>
    </span>
    <span class='desc'>
      Returns the range for the given row
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='TextBuffer.html#setText-instance'>
        ::<strong>setText</strong>(text)
      </a>
    </span>
    <span class='desc'>
      Replaces the entire contents of the buffer with the given <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String'>String</a>
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='TextBuffer.html#setTextInRange-instance'>
        Range ::<strong>setTextInRange</strong>(range, text, normalizeLineEndings = true)
      </a>
    </span>
    <span class='desc'>
      Sets the text in the given range.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='TextBuffer.html#setTextViaDiff-instance'>
        ::<strong>setTextViaDiff</strong>(text)
      </a>
    </span>
    <span class='desc'>
      Replaces the current buffer contents by applying a diff against the given contents.
    </span>
  </li>
</ul>
      <h2>Constructor Details</h2>
      <div class='methods'>
  <div class='method_details'>
    <p class='signature' id='constructor-instance'>
      ::<strong>constructor</strong>(params)
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Create a new buffer with the given params.</p>
</div>
<div class='tags'>
  <h3>Parameters:</h3>
  <ul class='param'>
    <li>
      <span class='type'>(String)</span>
      <span class='name'>params</span>
      &mdash;
      <span class='desc'>A <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String'>String</a> of text or an <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object'>Object</a> with the following keys:</span>
    </li>
    <ul class='options'>
      <li>
        <span class='type'>(Boolean)</span>
        <span class='name'>load</span>
        &mdash;
        <span class='desc'>A <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Boolean'>Boolean</a>, <code>true</code> to asynchronously load the buffer from disk after initialization.</span>
      </li>
      <li>
        <span class='type'>(String)</span>
        <span class='name'>text</span>
        &mdash;
        <span class='desc'>The initial <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String'>String</a> text of the buffer.</span>
      </li>
    </ul>
  </ul>
</div>
  </div>
</div>
      <h2>Instance Method Details</h2>
      <div class='methods'>
  <div class='method_details'>
    <p class='signature' id='append-instance'>
      Range ::<strong>append</strong>(text, normalizeLineEndings)
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Appends the given text to the end of the buffer</p>
</div>
<div class='tags'>
  <h3>Parameters:</h3>
  <ul class='param'>
    <li>
      <span class='type'>(String)</span>
      <span class='name'>text</span>
      &mdash;
      <span class='desc'>A <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String'>String</a> representing the text text to append.</span>
    </li>
  </ul>
  <h3>Returns:</h3>
  <ul class='return'>
    <li>
      <span class='type'></span>
      (<tt><a href='Range.html'>Range</a></tt>)
      &mdash;
      <span class='desc'>Returns the <a href='Range.html'>Range</a> of the inserted text</span>
    </li>
  </ul>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='characterIndexForPosition-instance'>
      ::<strong>characterIndexForPosition</strong>(position)
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Given a <a href='Point.html'>Point</a> representing a position in the buffer, returns a <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number'>Number</a> representing the absolute character offset of that location in the buffer, inclusive of newlines. The position is clipped prior to translating.</p>
</div>
<div class='tags'>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='clipPosition-instance'>
      ::<strong>clipPosition</strong>(position)
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Clips the given point so it is at a valid position in the buffer. For example, the position (1, 100) is out of bounds if the line at row 1 is only 10 characters long, and it would be clipped to (1, 10)</p>
</div>
<div class='tags'>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='clipRange-instance'>
      Range ::<strong>clipRange</strong>(range)
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Clips the given range so it starts and ends at valid positions if its start or end are out of bounds. For example, the position [1, 100] is out of bounds if the line at row 1 is only 10 characters long, and it would be clipped to (1, 10).</p>
</div>
<div class='tags'>
  <h3>Parameters:</h3>
  <ul class='param'>
    <li>
      <span class='type'>(Range)</span>
      <span class='name'>range</span>
      &mdash;
      <span class='desc'>A <a href='Range.html'>Range</a> to clip.</span>
    </li>
  </ul>
  <h3>Returns:</h3>
  <ul class='return'>
    <li>
      <span class='type'></span>
      (<tt><a href='Range.html'>Range</a></tt>)
      &mdash;
      <span class='desc'>Returns the given <a href='Range.html'>Range</a> if it is already in bounds, or a new clipped
<a href='Range.html'>Range</a> if the given range is out-of-bounds.</span>
    </li>
  </ul>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='delete-instance'>
      Range ::<strong>delete</strong>(range)
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Deletes the text in the given range</p>
</div>
<div class='tags'>
  <h3>Parameters:</h3>
  <ul class='param'>
    <li>
      <span class='type'>(Range)</span>
      <span class='name'>range</span>
      &mdash;
      <span class='desc'>A <a href='Range.html'>Range</a> in which to delete. The range is clipped before deleting.</span>
    </li>
  </ul>
  <h3>Returns:</h3>
  <ul class='return'>
    <li>
      <span class='type'></span>
      (<tt><a href='Range.html'>Range</a></tt>)
      &mdash;
      <span class='desc'>Returns an empty <a href='Range.html'>Range</a> starting at the start of deleted range.</span>
    </li>
  </ul>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='deleteRow-instance'>
      Range ::<strong>deleteRow</strong>(row)
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Deletes the line associated with the specified row.</p>
</div>
<div class='tags'>
  <h3>Returns:</h3>
  <ul class='return'>
    <li>
      <span class='type'></span>
      (<tt><a href='Range.html'>Range</a></tt>)
      &mdash;
      <span class='desc'>Returns the <a href='Range.html'>Range</a> of the deleted text.</span>
    </li>
  </ul>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='deleteRows-instance'>
      Range ::<strong>deleteRows</strong>(startRow, endRow)
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Deletes the specified lines associated with the specified row range. If the row range is out of bounds, it will be clipped. If the startRow is greater than the end row, they will be reordered.</p>
</div>
<div class='tags'>
  <h3>Returns:</h3>
  <ul class='return'>
    <li>
      <span class='type'></span>
      (<tt><a href='Range.html'>Range</a></tt>)
      &mdash;
      <span class='desc'>Returns the <a href='Range.html'>Range</a> of the deleted text.</span>
    </li>
  </ul>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='getEndPosition-instance'>
      ::<strong>getEndPosition</strong>()
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Returns a <a href='Point.html'>Point</a> representing the maximal position in the buffer.</p>
</div>
<div class='tags'>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='getFirstPosition-instance'>
      ::<strong>getFirstPosition</strong>()
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Returns a <a href='Point.html'>Point</a> at [0, 0]</p>
</div>
<div class='tags'>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='getLastLine-instance'>
      ::<strong>getLastLine</strong>()
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Returns a <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String'>String</a> representing the last line of the buffer</p>
</div>
<div class='tags'>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='getLastRow-instance'>
      ::<strong>getLastRow</strong>()
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Returns a <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number'>Number</a> representing the last zero-indexed row number of the buffer.</p>
</div>
<div class='tags'>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='getLineCount-instance'>
      ::<strong>getLineCount</strong>()
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Returns a <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number'>Number</a> representing the number of lines in the buffer.</p>
</div>
<div class='tags'>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='getLines-instance'>
      ::<strong>getLines</strong>()
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Returns an <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array'>Array</a> of <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String'>String</a>s representing all the lines in the buffer, without line endings.</p>
</div>
<div class='tags'>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='getMaxCharacterIndex-instance'>
      ::<strong>getMaxCharacterIndex</strong>()
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Returns the length of the buffer in characters.</p>
</div>
<div class='tags'>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='getRange-instance'>
      ::<strong>getRange</strong>()
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Returns a <a href='Range.html'>Range</a> associated with the text of the entire buffer, from its first position to its last position.</p>
</div>
<div class='tags'>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='getText-instance'>
      ::<strong>getText</strong>()
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Returns a <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String'>String</a> representing the entire contents of the buffer.</p>
</div>
<div class='tags'>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='getTextInRange-instance'>
      ::<strong>getTextInRange</strong>(range)
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Returns a <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String'>String</a> of text in the given <a href='Range.html'>Range</a>.</p>
</div>
<div class='tags'>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='insert-instance'>
      Range ::<strong>insert</strong>(position, text, normalizeLineEndings)
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Inserts the given text at the given position</p>
</div>
<div class='tags'>
  <h3>Parameters:</h3>
  <ul class='param'>
    <li>
      <span class='type'>(Point)</span>
      <span class='name'>position</span>
      &mdash;
      <span class='desc'>A <a href='Point.html'>Point</a> representing the insertion location. The position is clipped before insertion.</span>
    </li>
    <li>
      <span class='type'>(String)</span>
      <span class='name'>text</span>
      &mdash;
      <span class='desc'>A <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String'>String</a> representing the text to insert.</span>
    </li>
  </ul>
  <h3>Returns:</h3>
  <ul class='return'>
    <li>
      <span class='type'></span>
      (<tt><a href='Range.html'>Range</a></tt>)
      &mdash;
      <span class='desc'>Returns the <a href='Range.html'>Range</a> of the inserted text</span>
    </li>
  </ul>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='isEmpty-instance'>
      ::<strong>isEmpty</strong>()
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Returns a <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Boolean'>Boolean</a>, <code>true</code> if this buffer has no text, <code>false</code> otherwise.</p>
</div>
<div class='tags'>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='lineEndingForRow-instance'>
      ::<strong>lineEndingForRow</strong>(row)
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Returns a <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String'>String</a> representing the line ending for the given row.</p>
</div>
<div class='tags'>
  <h3>Parameters:</h3>
  <ul class='param'>
    <li>
      <span class='type'>(Number)</span>
      <span class='name'>row</span>
      &mdash;
      <span class='desc'>A <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number'>Number</a> indicating the row.</span>
    </li>
  </ul>
  <h3>Returns:</h3>
  <ul class='return'>
    <li>
      <span class='type'></span>
      <span class='desc'>Returns &#39;\n&#39;, &#39;\r\n&#39;, or &#39;&#39; for the last line of the buffer.</span>
    </li>
  </ul>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='lineForRow-instance'>
      ::<strong>lineForRow</strong>(row)
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Returns a <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String'>String</a> representing the contents of the line at the given row.</p>
</div>
<div class='tags'>
  <h3>Parameters:</h3>
  <ul class='param'>
    <li>
      <span class='type'>(Number)</span>
      <span class='name'>row</span>
      &mdash;
      <span class='desc'>A <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number'>Number</a> representing a zero-indexed row.</span>
    </li>
  </ul>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='lineLengthForRow-instance'>
      ::<strong>lineLengthForRow</strong>(row)
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Returns a <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number'>Number</a> representing the line length for the given row, exclusive of its line-ending character(s).</p>
</div>
<div class='tags'>
  <h3>Parameters:</h3>
  <ul class='param'>
    <li>
      <span class='type'>(Number)</span>
      <span class='name'>row</span>
      &mdash;
      <span class='desc'>A <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number'>Number</a> indicating the row.</span>
    </li>
  </ul>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='positionForCharacterIndex-instance'>
      ::<strong>positionForCharacterIndex</strong>(offset)
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Given a <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number'>Number</a> represting an absolute offset in the buffer, inclusive of newlines, returns a <a href='Point.html'>Point</a> representing that numbers corresponding position in row/column coordinates. The offset is clipped prior to translating.</p>
</div>
<div class='tags'>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='rangeForRow-instance'>
      Range ::<strong>rangeForRow</strong>(row, includeNewline)
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Returns the range for the given row</p>
</div>
<div class='tags'>
  <h3>Parameters:</h3>
  <ul class='param'>
    <li>
      <span class='type'>(Number)</span>
      <span class='name'>row</span>
      &mdash;
      <span class='desc'>A row <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number'>Number</a>.</span>
    </li>
    <li>
      <span class='name'>includeNewline</span>
      &mdash;
      <span class='desc'>Whether or not to include the newline, resulting in a range that extends to the start of the next line.</span>
    </li>
  </ul>
  <h3>Returns:</h3>
  <ul class='return'>
    <li>
      <span class='type'></span>
      (<tt><a href='Range.html'>Range</a></tt>)
      &mdash;
      <span class='desc'>Returns a <a href='Range.html'>Range</a>.</span>
    </li>
  </ul>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='setText-instance'>
      ::<strong>setText</strong>(text)
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Replaces the entire contents of the buffer with the given <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String'>String</a></p>
</div>
<div class='tags'>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='setTextInRange-instance'>
      Range ::<strong>setTextInRange</strong>(range, text, normalizeLineEndings = true)
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Sets the text in the given range.</p>
</div>
<div class='tags'>
  <h3>Parameters:</h3>
  <ul class='param'>
    <li>
      <span class='type'>(Range)</span>
      <span class='name'>range</span>
      &mdash;
      <span class='desc'>A <a href='Range.html'>Range</a>.</span>
    </li>
    <li>
      <span class='type'>(String)</span>
      <span class='name'>text</span>
      &mdash;
      <span class='desc'>A <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String'>String</a>.</span>
    </li>
  </ul>
  <h3>Returns:</h3>
  <ul class='return'>
    <li>
      <span class='type'></span>
      (<tt><a href='Range.html'>Range</a></tt>)
      &mdash;
      <span class='desc'>Returns the <a href='Range.html'>Range</a> of the inserted text.</span>
    </li>
  </ul>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='setTextViaDiff-instance'>
      ::<strong>setTextViaDiff</strong>(text)
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Replaces the current buffer contents by applying a diff against the given contents.</p>
</div>
<div class='tags'>
  <h3>Parameters:</h3>
  <ul class='param'>
    <li>
      <span class='type'>(String)</span>
      <span class='name'>text</span>
      &mdash;
      <span class='desc'>A <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String'>String</a> containing the new buffer contents.</span>
    </li>
  </ul>
</div>
  </div>
</div>
    </div>
    <div id='footer'>
  Generated on
  Thu Feb 27 2014 16:02:52 GMT-0800 (PST)
  by
  <a href='https://github.com/gjtorikian/biscotto' title='TomDoc-CoffeeScript API documentation generator'>Biscotto</a>
  v2.1.0
  (Node.js v0.10.21).
  &#10034;
  Press Ctrl-h to see the keyboard shortcuts
</div>
  </body>
</html>